﻿using Core.Infrastructure;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Infrastructure.Startups;

public partial class BoilerplateStaticFilesStartup : IBoilerplateStartup
{
    public virtual void ConfigureServices(IServiceCollection services, IConfiguration configuration)
    {

    }

    public void Configure(IApplicationBuilder application)
    {
        application.UseStaticFiles(new StaticFileOptions
        {
            OnPrepareResponse = ctx =>
            {
                ctx.Context.Response.Headers["Access-Control-Allow-Origin"] = "*";
                ctx.Context.Response.Headers["Access-Control-Allow-Methods"] = "GET,HEAD,OPTIONS";
            }
        });
    }
    public int Order => 99;
}
